<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品规格添加</title>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
    <legend>添加产品规格信息</legend>
</fieldset>
    <form class="layui-form layui-form-pane" action="" id="form1">
        <div class="layui-form-item">
            <label class="layui-form-label">速别</label>
            <div class="layui-input-inline">
                <input type="text" name="ct.type" lay-verify="required|number" placeholder="请输入" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">规格名称</label>
            <div class="layui-input-inline">
                <input type="text" name="ps.name" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">颜色</label>
            <div class="layui-input-inline">
                <input type="text" name="ct.color" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最大节数</label>
            <div class="layui-input-inline">
                <input type="text" name="ct.maxSection" lay-verify="required|number" placeholder="请输入" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最小节数</label>
            <div class="layui-input-inline">
                <input type="text" name="ct.minSection" lay-verify="required|number" placeholder="请输入" autocomplete="off" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结尾方式</label>
            <div class="layui-input-block">
                <input type="radio" name="ct.method" value="true" title="是" id="method1" lay-filter="">
                <input type="radio" name="ct.method" value="false" title="否" id="method2" lay-filter="">
            </div>
        </div>
    </form>
        <div class="layui-form-item">
            <button class="layui-btn" lay-filter="save" lay-submit>保存</button>
            <button class="layui-btn" lay-filter="back" type="button">返回</button>
        </div>

</body>
<script>
    layui.use(['element', 'layer', 'util','form','laydate','layedit','table'], function(){
        var element = layui.element
            ,layer = layui.layer
            ,util = layui.util
            ,form = layui.form
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,table = layui.table
            ,$ = layui.$;
        form.render();
    });
    $(".layui-btn :eq(1)").on("click",function () {
        toJumpGet($('.layui-body'),"/pages/ct/ctList.html");
    });
    layui.form.on('submit(save)', function(data){
        $.post(
            "/ct/save", $("#form1").serialize(), function (res) {
                //判断
                if (res.code == 0){
                    toJumpGet($('.layui-body'),"/pages/ct/ctList.html");
                } else {
                    layer.alert(res.msg);
                }
            }
        );
    });
</script>
</html>